package org.bigjava.travel.controller;

import org.bigjava.travel.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/admin")
public class ManagerController extends BaseController {

    @Autowired
    UserService userService;

    @RequestMapping("/index")
    public ModelAndView manager(){
        ModelAndView mv = this.getModeAndView();
        mv.setViewName("index");
        return mv;
    }

    @RequestMapping("/main")
    public ModelAndView main() throws Exception {
        ModelAndView mv = this.getModeAndView();
        mv.addObject("porvice",userService.countPorvice());
        mv.setViewName("main");
        return mv;
    }

    @RequestMapping("/404")
    public ModelAndView notFound(){
        ModelAndView mv = this.getModeAndView();
        mv.setViewName("404");
        return mv;
    }
}
